﻿<!DOCTYPE html>
<html lang="ch">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1, user-scalable=no">
	<meta http-equiv = "pragma" content = "no-cache">
<meta http-equiv = "Cache-Control" content = "no-cache,must-revalidate">
<meta http-equiv = "expires" content = "0">
<title>淘车网-优质二手车交易平台</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="css/reality-icon.css">
<link rel="stylesheet" type="text/css" href="css/bootsnav.css">
<link rel="stylesheet" type="text/css" href="css/owl.carousel.css">
<link rel="stylesheet" type="text/css" href="css/owl.transitions.css">
<link rel="stylesheet" type="text/css" href="css/settings.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="css/range-Slider.min.css">
<link rel="stylesheet" type="text/css" href="css/search.css">
<link href="css/popup-box.css" rel="stylesheet" type="text/css" media="all" />
<link rel="icon" href="images/icon.png">
<script src="js/jquery-2.1.4.js"></script>
<script type="text/javascript">
var action = "/getUserInfo";
$.get(
	action,
	function(data) {
		var user_info = data;
		var old = '';
		if(user_info.name==null||user_info.userTypeId != '2'){
			window.location.href='login.html';
		}
		else{
			old += '<ul class="nav navbar-nav" data-in="fadeIn" data-out="fadeOut"><li class="dropdown megamenu-fw active"><a href="admin_main.html">商家首页</a></li>'
				+'<li><a href="on_sale.html">在售车辆</a></li><li><a href="my_order.html">我的订单</a></li><li><a href="javascript:void(0);" onclick="logout()">退出登录</a></li></ul>';
		$("#navbar-menu").html(old);}
	});
var url = "/getBusinessInfo";
$.get(
		url,
		function(data) {
		var car_business = data;
		if(car_business.describe==null){
			car_business.describe = '';
		}
		var old2 = "";
		if(car_business.sid==-1){
			var old3 = ""; 
			old3 += '<div class="col-sm-12 bottom40"><form class="callus"><div class="row"><div class="col-sm-6"><div class="form-group"><input type="text" id="newSname" class="form-control" placeholder="商家名称"></div><div class="form-group"><input id="newDianhua" type="text" class="form-control" placeholder="联系方式"></div><div class="form-group"><input id="newDizhi" type="email" class="form-control" placeholder="商家地址"></div></div><div class="col-sm-6"><div class="form-group"><textarea id="newDescribe" class="form-control" placeholder="店铺描述"></textarea></div></div><div class="col-sm-12 row"><div class="row"><div class="col-sm-3"><button class="btn btn-info" data-toggle="modal" onclick="return bindInfo()" >绑定商家信息</button></div></div></div></div></form></div>'
				$("#bindInfo").html(old3);		
		}
		else{
		old2 += '<h3 id="name">'
		+ car_business.sname
		+'</h3><p class="bottom30">&ensp;&ensp;'

		+'</p><table class="agent_contact table"> <tbody><tr class="bottom10"><td><strong >手机:</strong></td><td class="text-left" id="tel">'
		+ car_business.tel+'</td></tr><tr class="bottom10"><td><strong>地址:</strong></td><td class="text-left">'
		+ car_business.dizhi +'</td></tr><tr class="bottom10"><td><strong>店铺描述</strong></td><td class="text-left">'
		+ car_business.describe
		+'</td></tr></tbody></table><div style="border-bottom:1px solid #d3d8dd;" class="bottom15"></div><ul class="social_share"><li><a href="javascript:void(0)" class="facebook"><i class="icon-facebook-1"></i></a></li><li><a href="javascript:void(0)" class="twitter"><i class="icon-twitter-1"></i></a></li><li><a href="javascript:void(0)" class="google"><i class="icon-google4"></i></a></li><li><a href="javascript:void(0)" class="linkden"><i class="fa fa-linkedin"></i></a></li><li><a href="javascript:void(0)" class="vimo"><i class="icon-vimeo3"></i></a></li></ul>'
		}
		$("#userInfo").html(old2);		
	}
);

function changePsw(){
	var oldPsw =  $("#oldPsw").val();
	var newPsw =  $("#newPsw").val();
	var checkedPsw =  $("#checkedPsw").val();
	if(oldPsw==null||oldPsw==''||newPsw==null||newPsw==''||checkedPsw==null||checkedPsw==''){
		alert('密码不能为空！');
		return false;
	}
	if(newPsw!=checkedPsw){
		alert('两次输入密码不一致');
		return false;
	}
	var url = "/changePsw?oldPsw=" + oldPsw +"&newPsw="+ newPsw;
	$.get(
			url,
			function(data) {
				if(data==0){
					alert('密码修改有误，请重试！');
				}
				if(data==1){
					alert('密码修改成功，请重新登录！');
					var url = '/logout';
					$.get(
							url,
							function(data) {
							if(data==1){
								window.location.href = 'login.html';							}
							if(data==0){
								alert('退出有误！');
							}
							}
							);
					
				}
			});
};

function changeUserInfo(){
	var sname =  $("#sname").val();
	var tel =  $("#dianhua").val();
	var describe =  $("#describe").val();
	var dizhi =  $("#dizhi").val();

	if(sname==null||sname==''||tel==null||tel==''||dizhi==null||dizhi==''||describe==null||describe==''){
		alert('信息不能为空！');
		return false;
	}
	if(!(/^1[3456789]\d{9}$/.test(tel))){ 
        alert("手机号码格式有误，请重新填写！"); 
		return false;
	}
	var url = "/bindBusinessUser?sname=" + sname +"&tel="+ tel+"&dizhi="+ dizhi +"&describe="+ describe;
	$.get(
			url,
			function(data) {
				if(data==0){
					alert('信息修改有误，请重试！');
				}
				if(data==1){
					alert('信息修改成功！');	
					window.location.reload();
				}
			});
};

function bindInfo(){
	var sname =  $("#newSname").val();
	var tel =  $("#newDianhua").val();
	var describe =  $("#newDescribe").val();
	var dizhi =  $("#newDizhi").val();

	if(sname==null||sname==''||tel==null||tel==''||dizhi==null||dizhi==''||describe==null||describe==''){
		alert('信息不能为空！');
		return false;
	}
	if(!(/^1[3456789]\d{9}$/.test(tel))){ 
        alert("手机号码格式有误，请重新填写！"); 
		return false;
	}
	var url = "/bindBusinessUser?sname=" + sname +"&tel="+ tel+"&dizhi="+ dizhi +"&describe="+ describe;
	$.get(
			url,
			function(data) {
				if(data==0){
					alert('绑定失败，请重试！');
				}
				if(data==1){
					alert('商家信息绑定功！');	
					window.location.reload();
				}
			});
};
</script>
</head>
<body>
 
<!--Header-->
<header class="layout_default">

  <nav class="navbar navbar-default navbar-sticky bootsnav">
    <div class="container">
      <div class="row">
        <div class="col-md-12">
          <!-- Start Header Navigation -->
          <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-menu">
            <i class="fa fa-bars"></i>
            </button>
          </div> <!-- End Header Navigation -->
          <div class="collapse navbar-collapse" id="navbar-menu">
          </div>
        </div>
      </div>
    </div>
  </nav>
</header>
<!--Header Ends-->

<!-- Page Banner Start-->
<section class="page-banner padding">
  <div class="container">
    <div class="row">
      <div class="col-md-12 text-center">
        <h1 class="text-uppercase">买二手车  上淘车网</h1>
        <p>上 万 款 优 质 二 手 车 恭 候 您 的 挑 选</p>
      </div>
    </div>
  </div>
</section>
<!-- Page Banner End -->


<!-- News Start -->
<section id="news-section-1" class="property-details padding_top">

   <div class="container property-details">
      <div class="row">
	  <div class="col-md-8 listing1">
        <div class="row">
          <div class="col-sm-6 bottom40">
            <div class="agent_wrap">
              <div class="image">
                <img src="images/agent-one.jpg" alt="Agents">
              </div>
            </div>
          </div>
          <div class="col-sm-6 bottom40">
            <div class="agent_wrap" id="userInfo">

            </div>
          </div>
        </div>
        <div id="bindInfo"></div>
      </div>
         <aside class="col-md-4 col-xs-12">
		 
            <div class="row">
               <div class="col-md-12">
                  <h3 class="bottom20">商家常用功能</h3>
                  <ul class="pro-list bottom20">
                     <li>				<div class="more">
					<a class=" popup-with-zoom-anim button-isi zoomIn animated" data-wow-delay=".5s" href="#small-dialog" id="changePsw">修改密码</a>				
				</div>
                     </li>
                    </br>
                     <li>				<div class="more">
					<a class=" popup-with-zoom-anim button-isi zoomIn animated" data-wow-delay=".5s" href="#small-dialog2" id="changeInfo">上架车辆</a>				
				</div>
                     </li>
                  </ul>
               </div>
            </div>
         </aside>
      </div>
      
   </div>
</section>
<!-- News End -->

	<!-- changeInfo -->
	<div class="pop-up"> 
		<div id="small-dialog" class="mfp-hide book-form">
		<h3>修改密码 </h3>
			<form action="#" method="post">
				<p>请输入原密码：</p>
				<input type="password" id="oldPsw" class="password" placeholder="" required=""/>
				<p>请输入新密码：</p>
				<input type="password" id="newPsw" class="password" placeholder="" required=""/>
				<p>请重复新密码：</p>
				<input type="password" id="checkedPsw" class="password" placeholder="" required=""/>					
				<center>
				<button type="button" class="btn-blue border_radius" onclick="return changePsw()">确认修改</button>
				</center>
			</form>
	</div>
				<div id="small-dialog2" class="mfp-hide book-form">
<h3>上架车辆</h3>
<form action="#" method="post">
<p>车辆标题<input type="text" id="sname" required=""/></p>
品牌<input style="width:100px;" type="text" id="describe" required=""/>&ensp;&ensp;
车系<input style="width:100px;" type="text" id="describe" required=""/>&ensp;&ensp;

颜色<input style="width:100px;" type="text" id="describe" required=""/>&ensp;&ensp;&ensp;

<br>上牌年份<input style="width:100px;" type="text" id="describe" required=""/>年&ensp;&ensp;&ensp;&ensp;
行驶里程<input style="width:100px;" type="text" id="describe" required=""/>公里&ensp;&ensp;
<br><button onclick="alert('经系统评定，该车参考价为10.00万元')">点击进行估价</button><br><br>
<label><input name="Fruit" type="radio" value="" />采纳系统估价 </label> <br>
<label><input name="Fruit" type="radio" value="" />自定义售价 </label> <input style="width:70px;" type="text" id="describe" required=""/>万元
				<center>
				<button type="button" class="btn-blue border_radius" onclick="return changeUserInfo()">下一步</button>
				</center></form>
	</div>
</div>	
<!-- // changeInfo  -->

<!--Footer-->
<footer class="footer_third">
  <div class="container padding_top">
    <!--CopyRight-->
    <div class="copyright_simple">
      <div class="row">
        <div class="col-md-6 col-sm-5 top20 bottom20">
          <p>Copyright &copy; 2020 <span>TaoCheNet</span>. All rights reserved.</p>
        </div>
        <div class="col-md-6 col-sm-7 text-right top15 bottom10">
          <ul class="social_share">
            <li><a href="#." class="facebook"><i class="icon-facebook-1"></i></a></li>
            <li><a href="#." class="twitter"><i class="icon-twitter-1"></i></a></li>
            <li><a href="#." class="google"><i class="icon-google4"></i></a></li>
            <li><a href="#." class="linkden"><i class="fa fa-linkedin"></i></a></li>
            <li><a href="#." class="vimo"><i class="icon-vimeo3"></i></a></li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</footer>


<script src="js/bootstrap.min.js"></script> 
<script src="js/bootsnav.js"></script>
<script src="js/jquery.parallax-1.1.3.js"></script>
<script src="js/jquery.appear.js"></script>
<script src="js/jquery-countTo.js"></script>
<script src="js/masonry.pkgd.min.js"></script>
<script src="js/range-Slider.min.js"></script>
<script src="js/owl.carousel.min.js"></script> 
<script src="js/jquery.cubeportfolio.min.js"></script>
<script src="js/selectbox-0.2.min.js"></script>
<script src="js/zelect.js"></script>
<script src="js/jquery.fancybox.js"></script>
<script src="js/jquery.themepunch.tools.min.js"></script>
<script src="js/jquery.themepunch.revolution.min.js"></script>
<script src="js/revolution.extension.layeranimation.min.js"></script>
<script src="js/revolution.extension.navigation.min.js"></script>
<script src="js/revolution.extension.parallax.min.js"></script>
<script src="js/revolution.extension.slideanims.min.js"></script>
<script src="js/revolution.extension.video.min.js"></script>
<script src="js/custom.js"></script>
<script src="js/functions.js"></script>
<script src="js/jquery.magnific-popup.js" type="text/javascript"></script>
<script type="text/javascript" src="js/modernizr.custom.53451.js"></script> 
<script>
						$(document).ready(function() {
						$('#changeInfo').magnificPopup({
							type: 'inline',
							fixedContentPos: false,
							fixedBgPos: true,
							overflowY: 'auto',
							closeBtnInside: true,
							preloader: false,
							midClick: true,
							removalDelay: 300,
							mainClass: 'my-mfp-zoom-in'
						});
						$('#changePsw').magnificPopup({
							type: 'inline',
							fixedContentPos: false,
							fixedBgPos: true,
							overflowY: 'auto',
							closeBtnInside: true,
							preloader: false,
							midClick: true,
							removalDelay: 300,
							mainClass: 'my-mfp-zoom-in'
						});
						        });  
						function logout(){
							var url = '/logout';
							$.get(
									url,
									function(data) {
									if(data==1){
										window.location.reload();
									}
									if(data==0){
										alert('退出有误！');
									}
									}
									);
						};
</script>
</body>
</html>

